using Business.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;

namespace Business.Permissions
{
    public class BusinessPermissionDefinitionProvider: PermissionDefinitionProvider
    {

        public override void Define(IPermissionDefinitionContext context)
        {
            var Business = context.AddGroup(BusinessPermissions.Business, L("Business"), MultiTenancySides.Tenant);

            var Book = Business.AddPermission(BusinessPermissions.Book.Default, L("Book"));
            Book.AddChild(BusinessPermissions.Book.Update, L("Edit"));
            Book.AddChild(BusinessPermissions.Book.Delete, L("Delete"));
            Book.AddChild(BusinessPermissions.Book.Create, L("Create"));

            var Sale = Business.AddPermission(BusinessPermissions.Sale.Default, L("Sale"));
            Sale.AddChild(BusinessPermissions.Sale.Update, L("Edit"));
            Sale.AddChild(BusinessPermissions.Sale.Delete, L("Delete"));
            Sale.AddChild(BusinessPermissions.Sale.Create, L("Create"));

            var SaPro = Business.AddPermission(BusinessPermissions.SaPro.Default, L("SaPro"));
            SaPro.AddChild(BusinessPermissions.SaPro.Update, L("Edit"));
            SaPro.AddChild(BusinessPermissions.SaPro.Delete, L("Delete"));
            SaPro.AddChild(BusinessPermissions.SaPro.Create, L("Create"));

            var Inventory = Business.AddPermission(BusinessPermissions.Inventory.Default, L("Inventory"));
            Inventory.AddChild(BusinessPermissions.Inventory.Update, L("Edit"));
            Inventory.AddChild(BusinessPermissions.Inventory.Delete, L("Delete"));
            Inventory.AddChild(BusinessPermissions.Inventory.Create, L("Create"));

            var PrintTemplate = Business.AddPermission(BusinessPermissions.PrintTemplate.Default, L("PrintTemplate"));
            PrintTemplate.AddChild(BusinessPermissions.PrintTemplate.Update, L("Edit"));
            PrintTemplate.AddChild(BusinessPermissions.PrintTemplate.Delete, L("Delete"));
            PrintTemplate.AddChild(BusinessPermissions.PrintTemplate.Create, L("Create"));

            #region  入库新版（启用）
            var Addwarehouse = Business.AddPermission(BusinessPermissions.Addwarehouse.Default, L("Addwarehouse"));
            Addwarehouse.AddChild(BusinessPermissions.Addwarehouse.Update, L("Edit"));
            Addwarehouse.AddChild(BusinessPermissions.Addwarehouse.Delete, L("Delete"));
            Addwarehouse.AddChild(BusinessPermissions.Addwarehouse.Create, L("Create"));


            #endregion

            #region  入库旧版（弃用）
            var Storage = Business.AddPermission(BusinessPermissions.Storage.Default, L("Storage"));
            Storage.AddChild(BusinessPermissions.Storage.Update, L("Edit"));
            Storage.AddChild(BusinessPermissions.Storage.Delete, L("Delete"));
            Storage.AddChild(BusinessPermissions.Storage.Create, L("Create"));
            #endregion

            #region  王佳茹
            var BorrowM = Business.AddPermission(BusinessPermissions.BorrowM.Default, L("BorrowM"));
            BorrowM.AddChild(BusinessPermissions.BorrowM.Update, L("Edit"));
            BorrowM.AddChild(BusinessPermissions.BorrowM.Delete, L("Delete"));
            BorrowM.AddChild(BusinessPermissions.BorrowM.Create, L("Create"));

            var BorrowPro = Business.AddPermission(BusinessPermissions.BorrowPro.Default, L("BorrowPro"));
            BorrowPro.AddChild(BusinessPermissions.BorrowPro.Update, L("Edit"));
            BorrowPro.AddChild(BusinessPermissions.BorrowPro.Delete, L("Delete"));
            BorrowPro.AddChild(BusinessPermissions.BorrowPro.Create, L("Create"));


            var CheckDetail = Business.AddPermission(BusinessPermissions.CheckDetail.Default, L("CheckDetail"));
            CheckDetail.AddChild(BusinessPermissions.CheckDetail.Update, L("Edit"));
            CheckDetail.AddChild(BusinessPermissions.CheckDetail.Delete, L("Delete"));
            CheckDetail.AddChild(BusinessPermissions.CheckDetail.Create, L("Create"));


            var CheckPlan = Business.AddPermission(BusinessPermissions.CheckPlan.Default, L("CheckPlan"));
            CheckPlan.AddChild(BusinessPermissions.CheckPlan.Update, L("Edit"));
            CheckPlan.AddChild(BusinessPermissions.CheckPlan.Delete, L("Delete"));
            CheckPlan.AddChild(BusinessPermissions.CheckPlan.Create, L("Create"));


            var CheckQ = Business.AddPermission(BusinessPermissions.CheckQ.Default, L("CheckQ"));
            CheckQ.AddChild(BusinessPermissions.CheckQ.Update, L("Edit"));
            CheckQ.AddChild(BusinessPermissions.CheckQ.Delete, L("Delete"));
            CheckQ.AddChild(BusinessPermissions.CheckQ.Create, L("Create"));

            var Deliverys = Business.AddPermission(BusinessPermissions.Deliverys.Default, L("Deliverys"));
            Deliverys.AddChild(BusinessPermissions.Deliverys.Update, L("Edit"));
            Deliverys.AddChild(BusinessPermissions.Deliverys.Delete, L("Delete"));
            Deliverys.AddChild(BusinessPermissions.Deliverys.Create, L("Create"));

            var GoodCom = Business.AddPermission(BusinessPermissions.GoodCom.Default, L("GoodCom"));
            GoodCom.AddChild(BusinessPermissions.GoodCom.Update, L("Edit"));
            GoodCom.AddChild(BusinessPermissions.GoodCom.Delete, L("Delete"));
            GoodCom.AddChild(BusinessPermissions.GoodCom.Create, L("Create"));

            var InDetail = Business.AddPermission(BusinessPermissions.InDetail.Default, L("InDetail"));
            InDetail.AddChild(BusinessPermissions.InDetail.Update, L("Edit"));
            InDetail.AddChild(BusinessPermissions.InDetail.Delete, L("Delete"));
            InDetail.AddChild(BusinessPermissions.InDetail.Create, L("Create"));

            var Inven = Business.AddPermission(BusinessPermissions.Inven.Default, L("Inven"));
            Inven.AddChild(BusinessPermissions.Inven.Update, L("Edit"));
            Inven.AddChild(BusinessPermissions.Inven.Delete, L("Delete"));
            Inven.AddChild(BusinessPermissions.Inven.Create, L("Create"));

            var RDetail = Business.AddPermission(BusinessPermissions.RDetail.Default, L("RDetail"));
            RDetail.AddChild(BusinessPermissions.RDetail.Update, L("Edit"));
            RDetail.AddChild(BusinessPermissions.RDetail.Delete, L("Delete"));
            RDetail.AddChild(BusinessPermissions.RDetail.Create, L("Create"));

            var RGoods = Business.AddPermission(BusinessPermissions.RGoods.Default, L("RGoods"));
            RGoods.AddChild(BusinessPermissions.RGoods.Update, L("Edit"));
            RGoods.AddChild(BusinessPermissions.RGoods.Delete, L("Delete"));
            RGoods.AddChild(BusinessPermissions.RGoods.Create, L("Create"));


            var SendG = Business.AddPermission(BusinessPermissions.SendG.Default, L("RGoods"));
            SendG.AddChild(BusinessPermissions.SendG.Update, L("Edit"));
            SendG.AddChild(BusinessPermissions.SendG.Delete, L("Delete"));
            SendG.AddChild(BusinessPermissions.SendG.Create, L("Create"));

            var SendInfo = Business.AddPermission(BusinessPermissions.SendInfo.Default, L("RGoods"));
            SendInfo.AddChild(BusinessPermissions.SendInfo.Update, L("Edit"));
            SendInfo.AddChild(BusinessPermissions.SendInfo.Delete, L("Delete"));
            SendInfo.AddChild(BusinessPermissions.SendInfo.Create, L("Create"));

            var SendDetail = Business.AddPermission(BusinessPermissions.SendDetail.Default, L("RGoods"));
            SendDetail.AddChild(BusinessPermissions.SendDetail.Update, L("Edit"));
            SendDetail.AddChild(BusinessPermissions.SendDetail.Delete, L("Delete"));
            SendDetail.AddChild(BusinessPermissions.SendDetail.Create, L("Create"));

            #endregion

            var ProductCuring = Business.AddPermission(BusinessPermissions.ProductCuring.Default, L("ProductCuring"));
            ProductCuring.AddChild(BusinessPermissions.ProductCuring.Update, L("Edit"));
            ProductCuring.AddChild(BusinessPermissions.ProductCuring.Delete, L("Delete"));
            ProductCuring.AddChild(BusinessPermissions.ProductCuring.Create, L("Create"));



            var DstributorController = Business.AddPermission(BusinessPermissions.DstributorController.Default, L("DstributorController"));
            DstributorController.AddChild(BusinessPermissions.DstributorController.Update, L("Edit"));
            DstributorController.AddChild(BusinessPermissions.DstributorController.Delete, L("Delete"));
            DstributorController.AddChild(BusinessPermissions.DstributorController.Create, L("Create"));


            var Produce = Business.AddPermission(BusinessPermissions.Produce.Default, L("Produce"));
            Produce.AddChild(BusinessPermissions.Produce.Update, L("Edit"));
            Produce.AddChild(BusinessPermissions.Produce.Delete, L("Delete"));
            Produce.AddChild(BusinessPermissions.Produce.Create, L("Create"));


            var Pricing = Business.AddPermission(BusinessPermissions.Pricing.Default, L("Pricing"));
            Pricing.AddChild(BusinessPermissions.Pricing.Update, L("Edit"));
            Pricing.AddChild(BusinessPermissions.Pricing.Delete, L("Delete"));
            Pricing.AddChild(BusinessPermissions.Pricing.Create, L("Create"));

            //Code generation...
        }

        private static LocalizableString L(string name)
        {
            return LocalizableString.Create<BusinessResource>(name);
        }
    }
}
